<template>
  <div>
      <qwerty title1="首页" title2="权限管理" title3="角色列表"></qwerty>
      
        <el-card style="margin-top:20px">
             <el-table :data="tableData" style="width: 100%">
                <el-table-column prop="authName" label="权限名称">
                </el-table-column>
                <el-table-column prop="path" label="路径">
                </el-table-column>
                <el-table-column prop="level" label="权限等级">
                    <template scope="scope">
                        <el-tag v-if="scope.row.level==0">一级</el-tag>
                        <el-tag type="success" v-if="scope.row.level==1">二级</el-tag>
                        <el-tag type="warning" v-if="scope.row.level==2">三级</el-tag>
                    </template> 
                </el-table-column>
             </el-table>

       </el-card>
  </div>
</template>

<script>
import {getRightsList} from '@/api/right.js'
export default {
created(){
       this.getUser();
    },
    methods:{
        async getUser(){
             var {data:res}=await getRightsList(`rights/${this.type}`);
            console.log(res);
            if(res.meta.status !==200){
                return this.$message.error("获取权限列表失败！")
            }
            this.tableData=res.data;
        }
    },
    data(){
        return{
            tableData:[],
            type:'list'
        }
    }
}
</script>

<style>

</style>